<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link href="css/index.css" rel="stylesheet">
		<!-- Bootstrap -->
			<link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
			<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
			<script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
			<!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
			<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
		
	</head>
	<body>
		<div class="container">
			<div class="col-md-12">
				<nav class="navbar navbar-default" role="navigation">
					<div class="navbar-header">
						<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button> <a class="navbar-brand" href="#">OnlyGroup</a>
					</div>
					<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
						<ul class="nav navbar-nav navbar-right">
							<li>
								<a href="index.html">首页</a>
							</li>
							<li>
								<a href="company.html">公司</a>
							</li>
							<li>
								<a href="group.html">分组</a>
							</li>
							<li>
								<a href="#">提问</a>
							</li>
							<li>
								<a href="about.html">关于</a>
							</li>
						</ul>
					</div>
				</nav>
			</div>
			<div class="row clearfix">
				<div class="col-md-offset-3 col-md-6 column">
					<ul id="udata">

					</ul>
				</div>
			
			</div>
			
			<div class="row clearfix" style="margin-top: 20px;">
				<div class="col-md-12 column">
					<h3>分组列表</h3>
				</div>
				
				<div class="col-md-12 column">
					<table class="table">
						<thead>
							<tr>
								<th>
									序号
								</th>
								<th>
									组号
								</th>
								<th>
									组长
								</th>
								<th>
									人数
								</th>
								<th>
									组员
								</th>
								<th>
									时间
								</th>
							</tr>
						</thead>
						<tbody id="tbdata">
						
						</tbody>
					</table>
				</div>
			</div>
		</div>
		<footer class="footer">
			<div class="container">
				<p style="text-align:center;padding-top:15px">Copyright © 2013-2021 OnlyGroup  condingsir.com All Rights Reserved. 备案号：闽ICP备15012807号-1</p>
			</div>
		</footer>
	</body>
	<script>
		var cid;
		let url = new URL(window.location.href);
		cid = url.searchParams.get("cid");
		loadData();
		//1.查询指定公司的详细数据数据
		function loadData(){
			//查询公司列表
			//js 如何获取地址路径的参数
			//Ajax-get
			$.get("/company/detail.do?id="+cid,function(res){
				if(res.code==0){
					$("#udata").html("");
					$("#udata").append(`<li>公司序号：${res.data.id}</li>
					<li>公司：${res.data.name}</li>
					<li>公司人数：${res.data.pernums}</li>
					<li>公司CEO：${res.data.person}</li>
					<li>时间：${res.data.ctime}</li>
					`);
					//接口返回成功
					$("#tbdata").html("");
					for(i in res.data.groupList){
						//es6
						$("#tbdata").append(`<tr><td>${res.data.groupList[i].id}</td>
						<td>${res.data.groupList[i].no}</td>
						<td>${res.data.groupList[i].gleader}</td>
						<td>${res.data.groupList[i].num}</td>
						<td>${res.data.groupList[i].persons}</td>
						<td>${res.data.groupList[i].ctime}</td>
						</tr>`);
					}
				}
			})
		}
	</script>
</html>
